/**
 * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
 * No deletion without permission, or be held responsible to law.
 * @author lzw
 */
import { defHttp } from '/@/utils/http/axios';
import { useGlobSetting } from '/@/hooks/setting';
import { BasicModel, Page } from '../model/baseModel';
import { UploadApiResult } from '../sys/upload';
import { UploadFileParams } from '/#/axios';

const { ctxPath, adminPath } = useGlobSetting();

export interface CasePush extends BasicModel<CasePush> {
  pushExcel?: string; // 推送表
  pushNumber?: number; // 推送数量
  yesNumber?: number; // 成功数量
  noNumber?: number; // 失败数量
  pushTime?: string; // 推送时间
}

export const casePushList = (params?: CasePush | any) =>
  defHttp.get<CasePush>({ url: adminPath + '/operating/casePush/list', params });

export const casePushListData = (params?: CasePush | any) =>
  defHttp.post<Page<CasePush>>({ url: adminPath + '/operating/casePush/listData', params });

export const casePushForm = (params?: CasePush | any) =>
  defHttp.get<CasePush>({ url: adminPath + '/operating/casePush/form', params });

export const casePushSave = (params?: any, data?: CasePush | any) =>
  defHttp.postJson<CasePush>({ url: adminPath + '/operating/casePush/save', params, data });

export const casePushImportData = (
  params: UploadFileParams,
  onUploadProgress: (progressEvent: ProgressEvent) => void,
) =>
  defHttp.uploadFile<UploadApiResult>(
    {
      url: ctxPath + adminPath + '/operating/casePush/importData',
      onUploadProgress,
    },
    params,
  );

export const casePushDisable = (params?: CasePush | any) =>
  defHttp.get<CasePush>({ url: adminPath + '/operating/casePush/disable', params });

export const casePushEnable = (params?: CasePush | any) =>
  defHttp.get<CasePush>({ url: adminPath + '/operating/casePush/enable', params });

export const casePushDelete = (params?: CasePush | any) =>
  defHttp.get<CasePush>({ url: adminPath + '/operating/casePush/delete', params });
